<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * Class ApiTable api接口基础信息表
 */
class ApiTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('api', function (Blueprint $blueprint) {
            $blueprint->increments('api_id')->comment('接口id');
            $blueprint->string('api_name')->comment('接口名称');
            $blueprint->string('remark')->comment('备注');
            $blueprint->string('domain')->comment('域名(采用变量的形式)');
            $blueprint->string('path')->comment('请求url');
            $blueprint->string('version')->comment('创建版本号(不需要v标示)');
            $blueprint->string('method')->comment('请求方法(GET,POST,PUT,DELETE等等)');
            $blueprint->string('content_type')->comment('请求内容类型');
            $blueprint->unsignedInteger('category_id')->comment('接口分类id');
            $blueprint->unsignedInteger('project_id')->comment('项目id');
            $blueprint->softDeletes();
            $blueprint->timestamps();
            $blueprint->index(['project_id','category_id'], 'idx_filter');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('api');
    }
}
